<template>
  <div>
    <navTop></navTop>
    <van-sidebar v-model="activeKey">
      <van-sidebar-item v-for="(item,index) in fenlei" :key="index" :title="item.type" :to="'/fenlei/fenleiList/'+item.typeId" />
    </van-sidebar>
    <router-view></router-view>
  </div>
</template>

<script>
import navTop from "@/components/common/navTop";
import getGoods from "@/api/getGoods.js"
export default {
  data() {
    return {
      activeKey: 0,
      fenlei:""
    };
  },

  components: {
    navTop
  },
  created(){
    this.getGoodstype()
  },
  methods: {
    async getGoodstype(){
      try{
        let p = await getGoods.getAllType();
        if(p.data.flag){
          this.fenlei = p.data.data
        }
      }catch(err){
        this.$toast.fail(err+"")
      }
    }
  }
};
</script>

<style scoped>
.van-sidebar-item{
  padding: 14px 22px;
  font-size: 12px;
  color: #000;
}
</style>